package woaini.wind.bot.command.qylc.app.api;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import woaini.wind.ai.controller.AIResponse;
import woaini.wind.ai.controller.AssistantService;
import woaini.wind.bot.core.command.ICmd;
import woaini.wind.bot.core.command.anno.CmdParams;
import woaini.wind.bot.core.command.anno.SubCmd;
import woaini.wind.bot.core.session.Session;

@Component
@RequiredArgsConstructor
@Slf4j
public class AiCmd implements ICmd {

  private final AssistantService assistantService;

  @Override
  public String masterCmdName() {
    return "xk";
  }

  @Override
  public String description() {
    return "小喀额外调用";
  }

  @SubCmd
  public void ai(
      Session session,
      @CmdParams(value = "[0]", description = "消息内容", required = true) String content,
      @CmdParams(value = "new", defaultValue = "false") Boolean newTalk) {

    Integer userId = session.getUserId();
    AIResponse assistant = assistantService.assistant(content,userId, newTalk);
    session.replyMessage(assistant.getContent());
  }
}
